#pragma once
#include "Unit.h"
#include "Range.h"
#include "Texture.h"

class CMelee : public CUnit
{
private:
	static int MeleeCounter;
	int MeleeCount;
	int random;
	float attacktime;
	Vector3D temploc;
	CUnit* Target;
	char *str;
	char* roles;
	int temphealth;
	int escChance;
public:
	enum State {
		STATE_IDLE = 0, // first
		STATE_ROAM,
		STATE_CHASE,
		STATE_ATTACK,
		STATE_FLEE,
		STATE_GIVESHIELD,
		STATE_TOTAL // last
	};

	enum Role {
		ROLE_ATTACK,
		ROLE_ASSIST,
		ROLE_TOTAL
	};

	State state;
	Role role;
	static Texture UnitTexture;

	CMelee(State state = STATE_IDLE);
	~CMelee();

	void ChangeState();
	void Respond(float Time);
	void Update(float Time);
	void Render(void);
	void UnitInteraction(CUnit*);
	void PrintState(int x, int y, float r, float g, float b, char *str);
	void PrintMessage(int x, int y, char *str);
	void CheckMessage(std::vector<MessageBoard*> &Msgb);

	void RandLoc(Vector3D &temp);
	void DealDamageTo(CUnit*);
	void HealTo(CUnit*);

	int GetMeleeCount(void);
};